Jump to content
Search Community

Halcyon last won the day on October 26 2014

Halcyon had the most liked content!

Halcyon

Business
  • Posts

    79
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by Halcyon

  1. I plan to distribute my HTML5 game as a nwjs app and I am using GSAP for all of my animations. I was wondering how much performance would be improved if there was a GSAP version that only targeted the latest Chrome builds for people using nwjs or Electron. Is this worth it? Would it noticeably enhance animation performance due to skipping all feature and version detection? This was just something I was thinking about and I was curious if it was on your (Jack, Carl) radar.

  2. Haven't messed with that before. Here's how I'm currently solving my problem... I'm using a few delayed sets that transition into a SteppedEase. This works, but I'll look into CustomEase, too.
     

    tl.set(test.mob.element, {
      overwrite: 1,
      backgroundPosition: '0% -300%'
    }).set(test.mob.element, {
      backgroundPosition: '-100% -300%'
    }, '+=.13')
      .set(test.mob.element, {
      backgroundPosition: '-200% -300%'
    }, '+=.12')
      .set(test.mob.element, {
      backgroundPosition: '-300% -300%'
    }, '+=.11')
      .to(test.mob.element, .4, {
      startAt: {
        backgroundPosition: '-400% -300%'
      },
      backgroundPosition: '-900% -300%',
      ease: SteppedEase.config(5),
      onComplete: function(){
        var filters = {
          opacity: 'opacity(100%)',
          brightness: "brightness(100%)"
        };
    
        var tl = new TimelineMax({
          onUpdate: function(){
            test.filters.death(test.mob.element, filters);
          }
        });
        tl.to(filters, 1.5, {
          opacity: 'opacity(0%)',
          brightness: "brightness(0%)"
        });
      }
    });

     

  3. SteppedEase is convenient for animating in a linear fashion between frames in a spritesheet, but what if I want an easing between each step? Is this possible? Let's say I want a monster to die and go through 10 frames of animation, but I don't want it to go through the frames in linear jumps. What if I'd like a Quad.easeOut through the steps for a more dramatic effect? Is that possible?

  4. I've made a few games using GSAP:

    Nevergrind - Single-Player RPG

    Firmament Wars - Realtime Multiplayer Strategy Game

    I have no regrets using GSAP. It's my favorite tool and as far as I'm concerned it hasn't limited me in any way and I feel very productive with it. I plan to make a 3rd game, a multiplayer co-operative rogue-like follow-up to Nevergrind. Developing games with GSAP is a pure joy. If needed you can even pause the game, as long as you don't use setTimeout or setInterval. As long as every timer and animation is created using GSAP (TweenMax, TimelineMax, TweenMax.delayedCall), you can just do TweenMax.pauseAll() to pause the game (this can be done in Nevergrind by hitting ESC).

     

    Since GSAP can tween any object value using any ease, it's simple to Tween using the set method, onUpdate, over time, or whatever kind of animating you need to do. Hope that helps. Discovering GSAP was like finding the holy grail for me because I was seriously using JQuery's .animate before that.

    • Like 7
    • Thanks 3
  5. This is perhaps not the best place for this question, but I know there's a lot of animation expertise in this forum. I generally don't want to use canvas due to its complexity and dev pain, so I am considering developing a simple pseudo 3d environment using GSAP. Think Phantasy Star 1 dungeon hallways, which was developed in 1987 on the Sega Master System. Can the DOM do something like this 30 years later? I don't need hills or anything complex like that. Just flat surfaces. Moving down hallways. Something suitable to a dungeon crawler RPG. The most complicated thing I would like is turning 90 degree corners. I think moving down a straight hallway wouldn't be too hard to develop. I think this could be done using either DOM or SVG...

     

    I'm curious if anyone has any pointers, advice, or general guidance on creating something like this using GSAP. Regardless, I am going to attempt developing something like this. I'm just curious if others have tried something similar.

     

    Sample video to get an idea what I have in mind:

     

     

  6. I just experimented with this tonight. In Chrome I was able to independently tween 1000 different 382x400 images using an infinite looping hue rotation. In Chrome it animated it flawlessly. I noticed that Firefox was choppier, but it still performed far beyond my expectations. I only expect to have 10 or 20 images on the screen, so it should perform very well on any modern desktop/browser combo.

    hue-rotate-test.jpg

  7. Kind of off-topic, but how much filtering can modern desktop browsers handle? Can I blur 2? 10? 20? 100 images? When would a desktop choke? This is something I will be experimenting with myself when I get the chance. I'm also curious about the performance compared to canvas.

  8. Perfect. This works perfectly! I was having a hard time getting the tween to actually work, but now it's working perfectly. Here's what I was using for folks that are interested:

     

    TweenMax.to('#mainBG', 3, {
      startAt: {
        filter: 'invert(0%) grayscale(0%) brightness(100%) sepia(0%) saturate(100%) hue-rotate(0deg)'
      },
      filter: 'invert(100%) grayscale(100%) brightness(100%) sepia(100%) saturate(400%) hue-rotate(120deg)'
    });

     

  9. I was having issues setting multiple CSS filters on an element. I wanted to create a colorization filter similar to what you'd see in GIMP or Photoshop. It seems like some filters don't play nicely with others. hue-rotate seems to be one culprit, among others:
     

    TweenMax.set('#main-bg', {
      filter: 'invert(40%)',
      filter: 'greyscale(100%)',
      filter: 'brightness(40%)',
      filter: 'sepia(100%)',
      filter: 'saturate(400%)',
      filter: 'hue-rotate(-50deg)'
    });

     

    It wasn't colorizing the element red as I expected. Is this possible using GSAP or are there known issues with tweening multiple filters? Is my syntax wrong? Do I need to set it as one property as an object or something like that?

  10. Bump for interest. Has anyone used GSAP in UnityScript? It seems like it would work, at least to some extent. I know some of the features probably wouldn't work, but I figure the basic tweening of object properties should work. We were thinking about developing a project in Unity at work, and we're still looking at options for how animation actually works.

  11. Thank you, Carl! This is so amazing! I think it wasn't working because I was trying to use it as an attr property. I updated the codepen. It looks so much smoother now! Here's what I went with:

    var arr = [
      document.getElementById('targetLine'),
      document.getElementById('targetLineShadow')
    ]
    TweenMax.to(arr, .2, {
      strokeDashoffset: '-=12',
      repeat:-1, 
      ease:Linear.easeNone
    })
    
  12. Ah, thanks. It seems so simple now that you explain it. Thank you. Also, can you do a demo that animates stroke-dashoffset in combination with a stroke-dasharray like 8,4? I was trying to animate a targeting path in a Risk-like game I'm developing, but I couldn't figure out how to do it with GSAP. Oddly, I figured out how to animate it using plain javascript, but I'd prefer to use GSAP. I didn't find any good examples of this that actually worked.

     

    Here's how I animated the dashed, offset line in javascript:

    function animateLine(val){
    	if (my.attackOn){
    		DOM.targetLine.style.strokeDashoffset = --val;
    		setTimeout(animateLine, 50, val);
    	} else {
    		DOM.targetLine.style.visibility = 'hidden';
    	}
    }
    
    • Like 1
  13. Animation/Workflow tip: Don’t forget - you can animate the viewBox attribute

    I don’t see this technique in practice (or talked about) very much, but sometimes it may be a better solution than trying to scale elements and center them.

     

    To illustrate this easy, but powerful method of SVG animation, I’ve made a simple house tour complete with some GreenSock home décor and a few nods to our great moderators. Take a look:

     

    See the Pen OMabPa by PointC (@PointC) on CodePen

    Love this viewbox technique. I want to use something like this for my game Firmament Wars. It's like Risk, so I'd have to focus on selected territories and stuff like that. Is there an easy way to determine the x y w h values for each path you want to focus on? Or does that have to be figured out and hardcoded one by one?

     

    Edit: Nevermind, I just read the rest of your comment. So you basically use Inkscape/Illustrator to find the coordinates you need? Very smart. I was thinking about this and the thought of using 3D scaling didn't sit well with me. It would be so much trial and error to get the right positions.

  14. I was, but I turned them off while troubleshooting. I think I figured out what is causing my problem. It's my code that attempts to make the parent container "responsive" for various screen sizes:

    e.style.marginTop = (-h / 2) + 'px';
    e.style.marginLeft = (-w / 2) + 'px';
    TweenMax.set("body", {
      left: "50%",
      top: "50%",
      opacity: 1,
      yPercent: -50,
      xPercent: -50,
      force3D: false
    });
     
    The yPercent and xPercent were causing my problems in Firefox. Gonna have to dink with this until life is perfect.
×
×
  • Create New...