Jump to content
GreenSock

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

Simple countdown not working

Go to solution Solved by PointC,

Recommended Posts

Hi! 

 

It's probably going to be very obvious lol but I am new here, and pretty new to coding too. 

 

I am building a game and trying to make some countdown, from 3 to 0, before the game actually starts. 

 

See the CodePen to get what I have done so far. Not working as intented, who would've guessed 🤣

 

The effects are what I am looking for, sorta, but it does display only 1, then 1, then 1... Not 3, 2, 1 😔

See the Pen jOGmNVw by LVH75 (@LVH75) on CodePen

Link to comment
Share on other sites

  • Solution

Hi @LuciusVH :)

 

Welcome to the forum.

 

When you call a function like that, you need to use onStartParams. You'd have something like this:

onStart: countdown, onStartParams:[3]

Loops and repeats can be quite helpful for something like a countdown. Here's another way to approach it. Maybe it'll give you some ideas.

 

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

 

Happy tweening and welcome aboard.

:)

 

  • Like 4
  • Thanks 1
Link to comment
Share on other sites

Yeaaay amazing!! Thanks for your help :) 

 

I have a feeling that I'm gonna love GSAP 😍

  • Like 2
Link to comment
Share on other sites

Hi!

Off-topic (!NOT about GSAP):

About counters watch video from "google chrome developers" chanel, they say about all problems with counters in one video

They create optimal solution 

  • Like 1
Link to comment
Share on other sites

But if you're using GSAP, you wouldn't need to worry about that because GSAP accurately handles time.

  • Like 3
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.
×