0
オーバーフローのコミュニティを使用してスクロールし、 私はスクロールして再生可能なアニメーションを探していたと私はjsファイルとJSについての知識の欠如とそのようなものを作りたかった同期スプライトとScrollMagic
を見つけましたライブラリ。 しかし、コピーしてすべての要素を過ぎても、それはまだ動作しません。
// initialise ScrollMagic controller
var controller = new ScrollMagic.Controller();
// create Tween
var tween = TweenMax.to("#js-animation", 1.0, {
\t backgroundPosition: "100% 0",
\t ease: SteppedEase.config(480)
})
// build scene
var scene = new ScrollMagic.Scene({duration: 15000})
\t .triggerHook("onCenter")
\t .setPin("#js-pinned")
\t .setTween(tween)
\t .addTo(controller);
body {
padding: 20px;
text-align: center;
}
.container {
font-size: 15em;
min-height: 110vh;
}
.cnc {
margin: auto;
width: 50%;
height: 50%;
background: url('http://image.gilawhost.com/16/12/29/9mq5kqgu.png') no-repeat 0 0%;
background-size: 100%;
}
h1 {
font-size: 1.2em;
}
p {
width: 60%;
margin: auto;
text-align: left;
}
.p {
margin-top: 120px;
font-size: 14px;
text-align: center;
}
<!DOCTYPE html>
<!--
come from the demo de Tom Bennet
http://www.sitepoint.com/responsive-sprite-animations-imagemagick-greensock
-->
<html >
<head>
<meta charset="UTF-8">
<title>Demo 4: Synchronising Playback with the Scrollbar</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
</head>
<body>
<h1>Demo 4: Synchronising Playback with the Scrollbar</h1>
<p>A responsive sprite animation that is synchronised with the scrollbar, and that remains in a fixed position for its duration of 1500 pixels. Scroll up and down to control playback.</p>
<div class="container" id="js-pinned">
<div class="cnc" id="js-animation"></div>
</div>
<p class="p">Demo by Tom Bennet. <a href="http://www.sitepoint.com/responsive-sprite-animations-imagemagick-greensock" target="_blank">See article</a>.</p>
<script src='https://cdnjs.cloudflare.com/ajax/libs/gsap/1.16.1/TweenMax.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.2/ScrollMagic.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/ScrollMagic/2.0.2/plugins/animation.gsap.min.js'></script>
</body>
</html>
私が何かを見逃したりスプライトが重すぎるファイルでありましたか?
は、それが正常に動作します、ありがとうございました! –