This plugin is meant to be used in conjunction with the Greensock Animation Plattform.
It offers an easy API to trigger Tweens or synchronize them to the scrollbar movement.
Both the lite
and the max
versions of the GSAP library are supported.
The most basic requirement is TweenLite
.
Oct 19, 2020 MagicScroll Why MagicScroll? If you have tried to use Apple magic mouse or macbook Trackpad, the scroll is very smooth. However normal scroll is not. In order to make the smilar effect I have tried to implement MagicScroll. We can apply this for any kind of place where mouse wheel is need to be smooth (For example, IndoorJS demo below) Demo. ScrollMagic is an awesome jQuery animation JS library that allows you to do lots of cool stuff when scrolling down/up your web & mobile page. With ScrollMagic plugin, you can. Start an animation at a specific scroll position. Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Latest Current Version: 16.6.1 (includes npm 7.20.3) Download the Node.js source code or a pre-built installer for your platform, and start developing today.
To have access to this extension, please include plugins/animation.gsap.js
.
This plugin is meant to be used in conjunction with the Greensock Animation Plattform. It offers an easy API to trigger Tweens or synchronize them to the scrollbar movement. Both the lite and the max versions of the GSAP library are supported. The most basic requirement is TweenLite. A customizable scrollbar component based on React.js for PC and mobile phone.
- plugins/animation.gsap.js, line 8
Requires
Scene Constructor Extension
new ScrollMagic.Scene(options)
Every instance of ScrollMagic.Scene now accepts an additional option.
See ScrollMagic.Scene
for a complete list of the standard options.
Parameters:
Name | Type | Argument | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options | object | <optional> | Options for the Scene. The options can be updated at any time. Properties
|
- plugins/animation.gsap.js, line 53
Example
Scene Control Methods
Scene.removeTween(reset) → {Scene}
Remove the tween from the scene.
This will terminate the control of the Scene over the tween.
Using the reset option you can decide if the tween should remain in the current state or be rewound to set the target elements back to the state they were in before the tween was added to the scene.
Parameters:
Name | Type | Argument | Default | Description |
---|---|---|---|---|
reset | boolean | <optional> | false | If |
- plugins/animation.gsap.js, line 293
Returns:
Example
Scene.setTween(TweenObject, duration, params) → {Scene}
Add a tween to the scene.
If you want to add multiple tweens, add them into a GSAP Timeline object and supply it instead (see example below).
If the scene has a duration, the tween's duration will be projected to the scroll distance of the scene, meaning its progress will be synced to scrollbar movement.
For a scene with a duration of 0
, the tween will be triggered when scrolling forward past the scene's trigger position and reversed, when scrolling back.
To gain better understanding, check out the Simple Tweening example.
Instead of supplying a tween this method can also be used as a shorthand for TweenMax.to()
(see example below).
Parameters:
Name | Type | Description |
---|---|---|
TweenObject | object|string | A TweenMax, TweenLite, TimelineMax or TimelineLite object that should be animated in the scene. Can also be a Dom Element or Selector, when using direct tween definition (see examples). |
duration | number|object | A duration for the tween, or tween parameters. If an object containing parameters are supplied, a default duration of 1 will be used. |
params | object | The parameters for the tween |
- plugins/animation.gsap.js, line 193
Returns:
Example
Scene Parameters (getter / setter)
Js Download File
Scene.tweenChanges(newTweenChanges) → {boolean}
Get or Set the tweenChanges option value.
This only affects scenes with a duration. If tweenChanges
is true
, the progress update when scrolling will not be immediate, but instead the animation will smoothly animate to the target state.
For a better understanding, try enabling and disabling this option in the Scene Manipulation Example.
Parameters:
Magicscroll Js Download For Mac
Name | Type | Argument | Description |
---|---|---|---|
newTweenChanges | boolean | <optional> | The new tweenChanges setting of the scene. |
- plugins/animation.gsap.js, line 65
Fires:
Magicscroll Js Download For Pc
Scene.change
,event: when used as setter
Returns:
{boolean}get
- Current tweenChanges option value.
Example
Magicscroll Js Download For Windows
The scroll
event allows reacting to a page or element scrolling. There are quite a few good things we can do here.
For instance:
- Show/hide additional controls or information depending on where in the document the user is.
- Load more data when the user scrolls down till the end of the page.
Here’s a small function to show the current scroll:
In action:
Magicscroll Js Download For Linux
Current scroll = scroll the window
The scroll
event works both on the window
and on scrollable elements.
Prevent scrolling
How do we make something unscrollable?
We can’t prevent scrolling by using event.preventDefault()
in onscroll
listener, because it triggers after the scroll has already happened.
But we can prevent scrolling by event.preventDefault()
on an event that causes the scroll, for instance keydown
event for pageUp and pageDown.
If we add an event handler to these events and event.preventDefault()
in it, then the scroll won’t start.
Javascript Download
There are many ways to initiate a scroll, so it’s more reliable to use CSS, overflow
property.
Magic Scroll Js Download Windows
Here are few tasks that you can solve or look through to see applications of onscroll
.