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

  • Home
  • SEARCH
  • 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 8726085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:10:53+00:00 2026-06-13T08:10:53+00:00

This is the code for a class: class Circle extends PApplet { //var declarations

  • 0

This is the code for a class:

class Circle extends PApplet {
  //var declarations

  Circle(int duration, int from, int to, PApplet parent, int x, int y, int length, int height){
    this.ani = new Tween(parent, 1.3f, Tween.SECONDS, Shaper.QUADRATIC);
    Class s = Shaper.QUADRATIC;
    this.from = from;
    this.to = to;
    this.len = length;
    this.height = height;
    this.x = x;
    this.y = y;
  }

  void update(){
    int c = lerpColor(this.from, this.to, this.ani.position(), RGB);

    fill(c);
    ellipse(this.x, this.y, this.len, this.height);
  }
}

When I run update() on a properly seeded version of Circle (see below example), I get this stack trace:

Exception in thread "Animation Thread" java.lang.NullPointerException
at processing.core.PApplet.fill(PApplet.java:13540)
at ellipses.Circle.update(Ellipses.java:85)
at ellipses.Ellipses.draw(Ellipses.java:39)
at processing.core.PApplet.handleDraw(PApplet.java:2128)
at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:190)
at processing.core.PApplet.run(PApplet.java:2006)
at java.lang.Thread.run(Thread.java:662)

It tells me that inside fill(), something is null when it shouldn’t be. I would at first assume the value passed to fill() is somehow wrong. The value to fill() comes from lerpColor(), so presumably I’ve used lerpColor() wrongly.

My instance of Circle looks like this:

int c1 = color(45, 210, 240);
int c2 = color(135, 130, 195);

cir = new Circle(1, c1, c2, this, 100, 200, 140, 140);
cir.update();

So how can I use fill()/lerpColor correctly?

(BTW, I’m using processing in eclipse with proclipsing.)

  • 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-06-13T08:10:54+00:00Added an answer on June 13, 2026 at 8:10 am

    Well first of all I am not entirely sure why would you need to extend the PApplet from a class that does not seem to be one of your windows, but i digress.

    If I understand what you are trying to do, the problem lies with the fill function and not with lerpColor. If you are trying to call the fill function of your main PApplet and this Circle class is not it, then you need to tell it on which PApplet to call it. i.e. the parent that you already send in. I’d do something like this.

    class Circle extends PApplet {
      //var declarations
      Tween ani;
      int from, to, x, y, len, heightz;
    
      PApplet parr; // prepare to accept the parent instance
    
      Circle(int duration, int from, int to, PApplet parent, int x, int y, int length, int height) {
        this.ani = new Tween(parent, 1.3f, Tween.SECONDS, Shaper.QUADRATIC);
        Class s = Shaper.QUADRATIC;
        this.from = from;
        this.to = to;
        this.len = length;
        this.heightz = height;
        this.x = x;
        this.y = y;
        parr = parent; // store the parent instance
      }
      void update() {
        color c = lerpColor(this.from, this.to, this.ani.position(), RGB);
        parr.fill(c); // call fill on the parent
        parr.ellipse(this.x, this.y, this.len, this.height); // this one obviously suffers from the same problem...
      }
    

    I hope this helps!
    pk

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Imagine this code: class foo { foo fff; int m_id; f & work() {
I have this code: class LFSeq: # lazy infinite sequence with new elements from
Hello I have this code class Triplets { public: int nVal1; int nVal2; NodeT
I have this code: class MyObj { int Id; string Name; string Location; }
First look at this code: class Program { static void Main(string[] args) { var
Consider this code : class MyClass<T> { } class AnotherClass : MyClass<String> { }
I have this code: class SomeClass: @classmethod def func1(cls,arg1): #---Do Something--- @classmethod def func2(cls,arg1):
So basically this code: class A { }; class B { B (const B&
There is this code: class SomeClass { public: SomeClass(){} SomeClass(SomeClass& b){} SomeClass(SomeClass&b, SomeClass& c){}
I have this code: class DocumentIdentifier attr_reader :folder, :name def initialize( folder, name )

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.