Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
sorciereus

Transforming a rotated div issues

Recommended Posts

Hi there. I'm trying to create a simple shooting star effect by scaling a rotated div.

 

First of all the div scales out as though the star is streaking across (which is correct), then the scale collapses changing it's transform origin. However, as you see in the codepen the div jumps around.

 

I'll probably make a work around and scale an image instead of a rotated div, but I thought I'd check to see if there was a way to do this utilizing only code.

 

JS

TweenMax.set('#star', {rotation:-30});
TweenMax.from("#star", .5, {scaleX:0});
TweenMax.to("#star", .5, {scaleX:0, transformOrigin:"left", delay:.5});

HTML

<div id="star">
    </div>

CSS

star
{
position:absolute;
top:-1;
left:68px;
width:285px;
height:94px;
border-top:1px solid #fff;
opacity:.5;
}

 

See the Pen jbQRmV by anon (@anon) on CodePen

Link to comment
Share on other sites

Aw super boss answer - I had tried that but had the rotated div inside the non rotated div - opps! Thanks (sort of head::palm at the moment) ;)

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.
×