Jump to content
Search Community

Search the Community

Showing results for tags 'array'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • GreenSock Forums
    • GSAP
    • Banner Animation
    • Jobs & Freelance
  • Flash / ActionScript Archive
    • GSAP (Flash)
    • Loading (Flash)
    • TransformManager (Flash)

Product Groups

  • Club GreenSock
  • TransformManager
  • Supercharge

Categories

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Personal Website


Twitter


CodePen


Company Website


Location


Interests

  1. Hi all, I'm sorry I can't duplicate this one on codepen, but I believe it's pretty straight forward. I am getting some data via an API-call and that data is displayed as a list of cards. So far so good. I would like to animate these card with a stagger when the user enters the page from the home page (like opacity 0 to opacity 1). I have been able to animte the whole card-container (<ListSection/>), but not each card on its own. I create each card in its own component (using react): <Card> <CardHeader>{name}</CardHeader> <PSmall>population</PSmall> <CardListHeader >{numeral(population).format("0,0")}</CardListHeader> <DetailButton to={`/data/${id + 1}`}>details</DetailButton> </Card> And then I use the Card in the List-component: <ListSection> {data.map((item, index) => { return ( <Card key={index} {...item} /> ) })} </ListSection> Some help please? Thank you
  2. Is there a way to tween the values of an array when in a for loop? I saw that there was an endArray plugin for the AS version of greensock which is close to what i'm looking for, but it doesn't appear to exits in js. Trying to do something like this: var array=[0,1,2,3,4,5]; for(var i=0; i<array.length; i++) { TweenLite.to(array, 0.5, {i:0}); }
  3. Hello all. First of all, I want to emphasize that this project is purely for practice purposes. I'm trying to get better at GSAP so any suggestions at all to improve my code or approach to this problem in any way are welcome. I was inspired by the level change screen of the video game, Just Shapes & Beats. If you're not sure what this is, check out this video. I made sure to time stamp it so it starts at the exact point it happens. I wanted to try to recreate this. To start, I programmatically generate 100 divs, attach event listeners to them, and use flex to space them out evenly. When a box is clicked, I use two arrays to separate the boxes that are above and below the target. Once I have those arrays, I loop through them and create a tween for each one that gets added to a timeline. Once that's done, I play the timeline. Here's the problem I'm running into. Because I'm creating tweens for every item in the array, I don't really know how to stagger them. I can't just use a class, because that would target all of them and they need to animate differently based off if they are above or below where the user clicked. I tried adding a delay to each tween, but the problem with that approach is when the animation for the blocks above the user click happens, the last block is delayed the greatest which is the opposite of what I want. That's my specific problem. But again, if you just have any general suggestions for a better way to approach this, I'd love to hear it. I'm still very much in the beginner stages of GSAP. Thank you. Edit --- Here is a debug link. It seems to show the animation better than the preview window inside codepen. https://cdpn.io/DDI-Web-Team/debug/06180d06502c57364e0a0f3ae563e79f
  4. I'm working on animating a grid of threejs boxes and I would like to implement the grid option available in the stagger object of the timeline, but when doing so I get an error: The example code only shows how to use the stagger options applied to DOM elements so I wonder if I'll need to create my own objects with properties that the grid optins will understand, which I can easly do, but I dont know what it is required. Hope that makes sense. Here is my setup: - There is an array of threejs Meshes layout in a grid - I want to create a timeline to animate all elements in the grid using the stagger grid options like: stagger: { amount: 1.5, grid: "auto", from: "center" } - But I'm getting the error quoted above Any help will be much appreciated.
  5. This looks so simple but I just can't figure out what the problem is. I'm creating a bezierPlugin demo and use an array of point objects both to define the bezier path and to distribute visual guides. TweenMax throws an error `invalid css tween value: [object Object]` like the objects aren't valid, but everything looks fine to me. The loop and pen works fine with any hardcoded object such as `{ x: 100, y: 100 }`. Why is the referenced object invalid in the `TweenMax.set()`? // Create dots and distribute them along the bezier path for (var i=0; i<6; i++) { var blueDot = new Dot(container); blueDot.target.className = "blue-dot"; //TweenMax.set(blueDot.target, pointObjects[i]); console.log(pointObjects[i]); // Looks like a valid object to me } Un-comment line 38 and see it break. Many thanks!
  6. I'm setting a delay as a negative number to simulate staggering. I'm wondering if there's a better way to achieve this with nested timelines.
  7. Hi guys, I 'm using Animate CC 2017 and i would like to animate one by one childs of a clip, which can be letters for example. I've tried using something like this : tl.staggerFrom(this.myClip.children, 0.6, {x:"-=50", alpha:0}, 0.03, "-=0.8"); but it doesn't works. Does someone using animate CC 2017 know if such a thing is possible ? Thanks for your help. Sorry for my english, it's not my native language.
  8. I found this very nice previous post, but I can´t make it work on adobe animate....any ideas from any actioscript guru?
  9. tell me how to make an array of blocks
  10. I have a movie clip that contains a lot of other MCs inside and actually too much to put them all in array. In old SWF times (AS2) I would just Export this movie clip as - Export for Acton Script with a Linkage to my .AS file (see the code that is now in .AS file). And then all of the inside movie clips (items) would animate as shown below. import com.greensock.*; import com.greensock.easing.*; class animate extends MovieClip { public function onLoad():Void { var item; for (item in this) { var mc = this[item]; TweenLite.from(mc, 1, {_alpha:0, _x:mc._x + 30, _xscale:5, delay: mc._x * 3/1000, ease:Circ.easeOut}); } } } Today, in HTML5 this linkage is not possible anymore. I'm trying to put this code into timeline to achieve the same effect. Is this even possible in for HTML5 ? I know that the tweenMax code needs to be adjust for AS3 usage, but that is not the issue here.
  11. Hi guys, I have these timelines that's very similar and I'm wondering if it's possible to loop through them or something to have a cleaner code? This is what I'm working with: var rt_step1 = $('.contact_module2016 .step1'), rt_step2 = $('.contact_module2016 .step2'), rt_step3 = $('.contact_module2016 .step3'), rt_step4 = $('.contact_module2016 .step4'), rt_step5 = $('.contact_module2016 .step5'), step1Timeline = new TimelineMax(), step2Timeline = new TimelineMax(), step3Timeline = new TimelineMax(), step4Timeline = new TimelineMax(), numbers = ["step1Timeline", "step2Timeline", "step3Timeline", "step4Timeline"]; step1Timeline.to(rt_step1, 0.6, {autoAlpha: 0, display:'none', ease: Expo.easeInOut, y:-30}) .to(rt_step2, 0.6, {autoAlpha: 1, display:'block', ease: Expo.easeInOut, y:0}); step1Timeline.pause(); step2Timeline.to(rt_step2, 0.6, {autoAlpha: 0, display:'none', ease: Expo.easeInOut, y:-30}) .to(rt_step3, 0.6, {autoAlpha: 1, display:'block', ease: Expo.easeInOut, y:0}); step2Timeline.pause(); step3Timeline.to(rt_step3, 0.6, {autoAlpha: 0, display:'none', ease: Expo.easeInOut, y:-30}) .to(rt_step4, 0.6, {autoAlpha: 1, display:'block', ease: Expo.easeInOut, y:0}); step3Timeline.pause(); step4Timeline.to(rt_step4, 0.6, {autoAlpha: 0, display:'none', ease: Expo.easeInOut, y:-30}) .to(rt_step5, 0.6, {autoAlpha: 1, display:'block', ease: Expo.easeInOut, y:0}); step4Timeline.pause(); This is what I'm trying to do but I get the error that numbers is not a function. Anyone done this before? for (i = 0; i < numbers.length; i++) { numbers[i].to(rt_step1, 0.6, {autoAlpha: 0, display:'none', ease: Expo.easeInOut, y:-30}) .to(rt_step2, 0.6, {autoAlpha: 1, display:'block', ease: Expo.easeInOut, y:0}); numbers[i].pause(); } Thanks so much for your attention and all the help
  12. Hi! I'm working on a custom plugin that is project specific. Basically, I created a class that represents an SVG arc and the plugin will tween the rotation of the arc around a point and change its thickness etc. Everything works perfectly except when I try to pass in an array of targets, in which case only the first element in the array is tweened, despite init() being called and run successfully. I've spent all day trying to figure this out and I can't make any headway, and I was hoping someone here had seen something similar and could give me some insight. I copied the code over to a codepen to see what I'm talking about, but it is probably easier to just to clone the repo: https://github.com/tysmithnet/gsap-svg-arc-plugin Just load up index.html Key files: SvgArc.js - class abstracting the svg arc, pretty much just knows how to create an SVG path gsap-svg-arc-plugin.js - the gsap plugin index.html - test file illustrating the issue Thanks for looking! T
  13. There are often times where I'd like to alternate each line of text flying in. Or different objects flying in from different sides. Most of the time I have to get a list of the objects that I want to tween and then alternate the properties each time. Is there anything like that built into TweenMax? If not, it might be a pretty easy thing to add... I do these animations a lot. I wonder if others do to?
  14. Hi, Like you'll see in the codepen, my array of target is not updated. Is there a solution to do that ? Thank you guys Izigo
  15. Hi everyone, Only started using GSAP yesterday, until that point I was using Velocity.js on the basis of the rather disingenuous test that was originally listed on Julian's site (intentionally or not!) So anyway I discovered that GSAP dunks all over it and I wanted in! So, at the moment I'm making a UI pack for GSAP, since that was one of my most used features of Velocity, and it's great for front-end delights. It's going really well and I've taken to GSAP fairly quickly--but some things still elude me. One thing I'm trying to achieve is to do with one of the animations I've made, it's a 'shake', these are my first with multiple tween points, and I'm trying to figure out the way I'd go about successfully staggering a whole sequence on an array of elements. E.g. case 'stagger.shake': animate.to( element, 0.1, {left: "-=" + (nudge/2) + "px", ease:easing} ).to( element, 0.1, {left: "+=" + nudge + "px", ease:easing} ).to( element, 0.1, {left: "-=" + nudge + "px", ease:easing} ).to( element, 0.1, {left: "+=" + nudge + "px", ease:easing} ).to( element, 0.1, {left: "-=" + nudge + "px", ease:easing} ).to( element, 0.1, {left: "+=" + nudge + "px", ease:easing} ).to( element, 0.1, {left: "0px", ease:easing} ); break; My initial approach was something like this: case 'stagger.shake': animate.staggerTo( element, 0.1, {left: "-=" + (nudge/2) + "px", ease:easing}, stagger ).staggerTo( element, 0.1, {left: "+=" + nudge + "px", ease:easing}, stagger ).staggerTo( element, 0.1, {left: "-=" + nudge + "px", ease:easing}, stagger ).staggerTo( element, 0.1, {left: "+=" + nudge + "px", ease:easing}, stagger ).staggerTo( element, 0.1, {left: "-=" + nudge + "px", ease:easing}, stagger ).staggerTo( element, 0.1, {left: "+=" + nudge + "px", ease:easing}, stagger ).staggerTo( element, 0.1, {left: "0px", ease:easing}, stagger ); break; I'm sure one of you guys knows exactly what I'm missing! Seems like a great community here and looking forward to becoming a part of it. GSAP is awesome. And not in the desensitised meaning of the word, like genuinely awesome!
  16. The code is below. When Tweenlite is called it treats "tileList[count1]" as a string instead of a variable name. However the trace seems to return what I would expect (tile1, tile2, tile3...). If I remove "tileList[count1]" from the tween and replace it with a direct call to the MovieClip (tile1, tile2, etc) the code works perfectly... Things I've tried: Using a vector instead of an array. Setting tileList[count1] to a public and local variable and then calling that variable. Removing the randomSort. Removing count1 and calling the array element directly (ie, tileList[5]). public class wtpMain extends MovieClip { public var tileList:Array = new Array(tile1,tile2,tile3,tile4,tile5,tile6,tile7,tile8,tile9,tile10,tile11,tile12,tile13,tile14,tile15 ,tile16); public var count1:int = 0; public function wtpMain() { nextButton.buttonMode = true; nextDis.mouseEnabled=false; nextButton.addEventListener(MouseEvent.CLICK, nextButtonClickh); tileList.sort(randomSort); } public function nextButtonClickh(event:MouseEvent):void { nextButtonClick(); } public function nextButtonClick():void{ TweenLite.to(tileList[count1], 5, {y:700, alpha:0}); trace(tileList[count1]); count1++; } public function randomSort(objA:Object, objB:Object):int{ return Math.round(Math.random() * 2) - 1; } } }
  17. First thanks to Jamie and Jack for answering a similar question. Turns out I was asking the wrong question What I'm failing to achieve is something very similar to the Draggable Spin demo... http://www.greensock.com/draggable My requirement has two differences: I need to snap to a bunch of degrees from an array that are not in even increments. For example [0, 88, 185, 268]. I need a callback so I can display information related to the "snapped" degree. You can think of this as the Wheel of Fortune with uneven distances between each pin. A few things to note: I tried supplying an array to the snap option, but once the dial turns more than one rotation, it comes whipping back like it's attached to a rubber band. In addition, I can't use a callback with this technique (I don't think). But the GreenSock Spin demo allows you to spin the dial around and around, and it smoothly lands on a "snap" degree. Thanks for any help!
  18. Let's say, I would like to set the opacity of my .logo and .loader to opacity 1 I will do .set($(".logo"), {opacity:1}); and the same for .loader The API says the .set method could accept an array of objects, how do I pass in an array of objects? How do I combine them into 1 line of code? .set([$(".ip-logo"), $(".ip-loader")], {opacity:1}) This isn't working.
  19. Hi! This is what I'm trying to achieve: I want to tween a collection of 4 rectangles aligned vertically and transform them into circles. tl.to( $buttons, 0.5, { borderRadius: '50%'}, 'circle' ); // no problem Now I want to shift those circles to the right so that they're aligned diagonally while the circle transformation above is happening, hence the label 'circle'. Ideally, something like this: tl.to( forAllElementsIn( $buttons ), 0.5, { x: x+displacement, delay: 1, onComplete: function () { displacement+=25 }, 'circle' ); The delay would be because I want one circle to move right then circle2 then circle3 and then circle 4 to form a diagonal alignment. Is there a simple way to do this? I thought of just using a for-loop: for ( btn in $buttons ), but I don't know how the labeling will work out with tweens outside of that for loop. Thanks for the help!
  20. I searched around a bit to see if this had been suggested before - I'm guessing it has, but just in case - you can already pass in an array of clips to have their properties tweened - why not allow passing in a vector (e.g. Vector.<DisplayObject>) as well? mostly for the sake of sheer convenience in not having to switch collection formats when you need to tween things.
  21. Hi all, I'm new to GSAP, but it looks very cool and is almost perfect for my application. I have an object with a 3D position "property", but that uses getters and setters, and returns a copy of the array in the getter. object.position([x, y, z]); var zval = object.position()[2]; // getter returns internalpos.slice() My ideal syntax would be something like this: TweenMax.to(object, 1, {position: [x, y, z]}); This doesn't work as arrays will need some special handling to do element-wise manipulation which GSAP doesn't do by default. If the position property was the array itself, then either of these would work: TweenMax.to(object.position, 1, [x, y, z]); TweenMax.to(object.position, 1, {endArray: [x, y, z]}); // Using EndArrayPlugin Unfortunately with the getter returning a copy, there is no way to get a reference to the internal array object, so no way that I can see of using GSAP directly. It would also be nice to be able to list multiple properties in the same tween. So I probably could rustle up a plugin to handle "position", etc, specifically. But I wonder if it would be possible to make that more generic. Perhaps syntax like this could work: TweenMax.to(object, 1, {arrays: {position: [0, 1, 2], rotation:[0, 0, 0]}}); Any thoughts? Is the above going to be possible with a plugin, and could it reuse the existing GSAP magic for detecting raw properties vs getters/setters? Simon
  22. Hey everyone so maybe you can help I have created a game using Flash CS6 and Flash Develop. I have objects that are added to the stage by a timer Event named "_Obstacles". These _Obstacles are all added Randomly to the stage. Now they get pushed onto the stage like so: private function addObstacle(e:TimerEvent):void { _Obstacles = new mcObstacles(); stage.addChild(_Obstacles); aObstacleArray.push(_Obstacles); trace(aObstacleArray.length); //TweenLite.to(_Obstacles, 2.7, {x: - 300}); } In my _obstacle class I removed this: if (sDirection == "R") { //Move obstacle left this.x -= nSpeed; } and added the line as shown above to my Main Engine class instead but its still be controlled by the timer: TweenLite.to(_Obstacles, 2.7, {x: - 300}); Now this works fine and they move across the stage correctly. But I am still experiencing major lag. I dont understand why. So I was thinking maybe it could be the TIMER_EVENT that is causing the lag and if i figure out how to push out the random array of objects every 2.7 seconds and remove the TIMER_EVENT someo how it will stop the lag. My game is simple and i dont understand why its lagging this is the only thing i can think of. Its a basic player jumping over the obstacles added to the stage by the timer. So I'm sure that the timer is the corporate. Please help.
  23. So I have a loop of lights lighting and diming - right now I have this happening in timelinelite with results that I find satisfactory. However, I'm wondering if any of you devs have a even more streamlined way of accomplishing this via timelinemax and an array? Can you let me know anymore details about the technic I'm demonstrating here? var tl = new TimelineLite(); tl.to("lens_flare1", .25, {alpha:1, scaleX:1.2, scaleY:1.2}) .to("lens_flare1", .25, {alpha:0, scaleX:1, scaleY:1}) .to("lens_flare3", .25, {alpha:1, scaleX:1.2, scaleY:1.2}) .to("lens_flare3", .25, {alpha:0, scaleX:1, scaleY:1}) .to("lens_flare2", .25, {alpha:1, scaleX:1.3, scaleY:1.3}) .to("lens_flare2", .25, {alpha:0, scaleX:1, scaleY:1}) .to("lens_flare4", .25, {alpha:1, scaleX:1.4, scaleY:1.4}) .to("lens_flare4", .25, {alpha:0, scaleX:1, scaleY:1}) .to("lens_flare2", .25, {alpha:1, scaleX:1.3, scaleY:1.3}) .to("lens_flare2", .25, {alpha:0, scaleX:1, scaleY:1}) .to("lens_flare1", .25, {alpha:1, scaleX:1.2, scaleY:1.2}) .to("lens_flare1", .25, {alpha:0, scaleX:1, scaleY:1}) .to("lens_flare4", .25, {alpha:1, scaleX:1.4, scaleY:1.4}) .to("lens_flare4", .25, {alpha:0, scaleX:1, scaleY:1}) .to("lens_flare3", .25, {alpha:1, scaleX:1.2, scaleY:1.2}) .to("lens_flare3", .25, {alpha:0, scaleX:1, scaleY:1}) .to("lens_flare2", .25, {alpha:1, scaleX:1.3, scaleY:1.3}) .to("lens_flare2", .25, {alpha:0, scaleX:1, scaleY:1}) .to("lens_flare1", .25, {alpha:1, scaleX:1.6, scaleY:1.2}) .to("lens_flare1", .25, {alpha:0, scaleX:1, scaleY:1}) .to("lens_flare4", .25, {alpha:1, scaleX:1.4, scaleY:1.4}) .to("lens_flare4", .25, {alpha:0, scaleX:1, scaleY:1}) .to("lens_flare3", .25, {alpha:1, scaleX:1.2, scaleY:1.2}) .to("lens_flare3", .25, {alpha:0, scaleX:1, scaleY:1}) ;
  24. Hi all, I am very new to loadermax and fairly inexperienced with AS3 so apologise if I have missed or misunderstood some documentation that explains this. I am currently using SWFLoader to load 3 external swfs into a main swf. I have constructed a preloader in this main swf that 'draws' a ring using masking. The ring currently tracks the load progress of the whole queue (see code below) however I want it to track the load progress of Atoms.swf. The ultimate aim is to repeat this for the other array assets. //Load external SWFs into queue LoaderMax.activate([SWFLoader]); var urls:Array = ["Atoms.swf","Compounds.swf","Quiz.swf"]; var queue:LoaderMax = LoaderMax.parse(urls); var swfs:Array = queue.content; queue.load(); queue.addEventListener(ProgressEvent.PROGRESS, onLoading); function onLoading(event:LoaderEvent):void { //set variables to calculate ring rotation var loaded1:Number = event.target.progress; var counter1=(loaded1*100)*3.6; //mask one semi-ring over the other masked1_mc.mask=masking1_mc; masked1_mc.rotation=counter1; if(masked1_mc.rotation<0){ masked1_mc.mask=null } My reasoning tells me that the event.target.progress needs to be changed to track the asset loading however I am unsure what code (if any) would accomplish this. I have considered just hard-coding a ratio of queue progress to swf size for each asset but would really prefer something a bit more dynamic (so I don't need to change it when I update the external swfs in future). I realise that this may not be the best implementation of loadermax however it currently works and I would prefer not to change it unless necessary. Sorry if this seems a bit long winded, I would really appreciate a speedy response for some enlightenment in this matter. Thanks for LoaderMax, the whole of GreenSock and helpful responses.
  25. Hi Greensockers - you will see that my trouble is not Greensock but rather incorporating a two dimension Array to feed back into the TimelineMax tweens that I have set up. I have seen that it's possible to have the Tweens inside the array as it loads and have attempted that as well. I'm fairly sure that my limited programming knowledge hasn't helped me and I apologise for the circuitous methods employed. If anyone has time to plough through all this I would appreciate any help you can provide. Once I have the array loading and feeding I will add some colouration. Many thanks - Trevor Forgot - CodePen working is: http://cdpn.io/mkCJd and non-working is: http://cdpn.io/Abjip http://codepen.io/thorntontf/public/ greensock.html greensock array test.html
×
×
  • Create New...