Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4015562
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:38:03+00:00 2026-05-20T09:38:03+00:00

I am trying to make a timer and I want a circle that is

  • 0

I am trying to make a timer and I want a circle that is always shown. It starts out green. As time progress’ a growing red pie slice begins to occupy more and more of the circle until the entire circle is red. Does that make sense?

The restrictions are that I can’t use sprite, so it would have to be done with UIComponent or some other format. Additionally, I can’t use degrafa. The SDK I am using does not support these methods.

UPDATE: Sweet! Thanks for the code. It works like a champ. My only hold back is that the SDK I am using does not support rotation, but I think I can make this all work. Thank you so much!! For others that can’t use sprite, just substitute UIComponent where sprite is.

FOLLOW-UP: I am pretty sure rotate is the only way, but is it possible to make it start at the 12 o’clock position without rotate?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T09:38:03+00:00Added an answer on May 20, 2026 at 9:38 am

    Use another Shape as a mask to perform the reveal.

    Code sample for expanding pie wedge

    Instantiate your Sprite:

    sp = new Sprite();
    sp.graphics.beginFill(0xC3C3C3);
    drawWedge(sp, 50, 150, 150, ang, 0);
    sp.graphics.endFill();
    addChild(sp);
    

    Draw wedge code:

    private function drawWedge (obj:Sprite, r:Number, x:Number,
                                y:Number, angle:Number, rotation:Number):void {
        // start at 0,0 so rotation will be around the point of the wedge
    
        obj.graphics.moveTo(0, 0);
        obj.graphics.lineTo(r, 0);
    
        var TO_RADIANS:Number = Math.PI/180;
    
    
        // calculate 30-degree segments for accuracy
        var nSeg:Number = Math.floor(angle/30);   // eg 2 if angle is 80
        var pSeg:Number = angle - nSeg*30;        // eg 20 if angle is 80
    
        // draw the 30-degree segments
        var a:Number = 0.268;  // tan(15)
        for (var i:Number=0; i < nSeg; i++) {
            var endx:Number = r*Math.cos((i+1)*30*TO_RADIANS);
            var endy:Number = r*Math.sin((i+1)*30*TO_RADIANS);
            var ax:Number = endx+r*a*Math.cos(((i+1)*30-90)*TO_RADIANS);
            var ay:Number = endy+r*a*Math.sin(((i+1)*30-90)*TO_RADIANS);
            obj.graphics.curveTo(ax, ay, endx, endy);   
        }
    
        // draw the remainder
        if (pSeg > 0) {
            a = Math.tan(pSeg/2 * TO_RADIANS);
            endx = r*Math.cos((i*30+pSeg)*TO_RADIANS);
            endy = r*Math.sin((i*30+pSeg)*TO_RADIANS);
            ax = endx+r*a*Math.cos((i*30 + pSeg-90)*TO_RADIANS);
            ay = endy+r*a*Math.sin((i*30 + pSeg-90)*TO_RADIANS);
            obj.graphics.curveTo(ax, ay, endx, endy);
        }
        obj.graphics.lineTo(0, 0);
    
        // rotate the wedge to its correct location in the circle
        obj.rotation = rotation;
        obj.x = x;
        obj.y = y;
    }
    

    Then us this in your animate code:

    if (ang > -1) {
        sp.graphics.clear();
        sp.graphics.beginFill(0xC3C3C3);
        drawWedge(sp, 50, 150, 150, ang, 0);
        ang--; //angle to decrease
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make an object that handles basic time related functions. I want
hi i am trying to make a wizard for first time i want to
I am trying to make a simple timer application. I want the timer to
I am trying to make a timer for my game that counts down from
I'm trying some time, but without success. I made some circle with animation that
I am trying to make a little application that simulates the dice. I want
I'm trying to make a timer in c++. I'm new to c++. I found
Im trying to make a countdown timer run in the background of my activity,
I'm trying to make a time with Time.local which in my code is dynamic.
I am trying to make an action where every time you press a button,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.