Jump to content
Search Community


isaballoon test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Moving from AS3 to JS - how can I recreate this functionality (as accomplished in AS3) with GSAP? (Button is an image).



btn.addEventListener(MouseEvent.MOUSE_OVER, over);
btn.addEventListener(MouseEvent.MOUSE_OUT, out);
function over(e:MouseEvent):void {
TweenLite.to(btn, 1, {alpha: 1});
function out(e:MouseEvent):void {
TweenLite.to(btn, 1, {alpha: .6});


Thanks guys

Link to comment
Share on other sites

The JavaScript is extremely similar



var btn = document.getElementById("btn");

//handles vendor prefixes in css
TweenLite.set(btn, {opacity:0.5});

btn.onmouseover = function() {
  TweenLite.to(btn, 0.5, {opacity:1});

btn.onmouseout = function() {
  TweenLite.to(btn, 0.5, {opacity:0.5});


Try it here:

See the Pen c68159b6af2ce0fdf1271d6773a2537a by GreenSock (@GreenSock) on CodePen

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...