Mouse-wobbling blobby things

I’ve been spending the last few days on some rather interesting ActionScript challenges. I’ve been building a sort of a lava lamp gloopy movement machine. I’ve been up to my neck in physics and trigonometry, so today when I had to change the way that the mouse moves objects around in the “gloop”, I got too carried away with triangles and tangents before coming home to think, and realising how simple it ought to be. Here’s some fun code, paste it into any MovieClip in Flash: put it on the first frame and then on the last frame, add a simple gotoAndPlay(2) so that the initialisation doesn’t take place twice. Or turn it into a proper object: this is just my quick & dirty version:

reach = 250; // radius of the "force field" around the mouse (pixels)
strength = 10; // strength of the mouse effect, 1-100
speedx = Math.random() * 3; // initial x speed
speedy = Math.random() * 3; // inital y speed

this.onEnterFrame = function ()
_x += speedx;
_y += speedy;
if (_x < 0 || _x > Stage.width)
speedx = -speedx;
if (_y < 0 || _y > Stage.height)
speedy = -speedy;
distance = Math.sqrt(Math.pow (_xmouse, 2) + Math.pow (_ymouse, 2));
if (power > 0)
power = Math.max (0, reach - distance) / reach;
oldX = _xmouse;
oldY = _ymouse;

function updateSpeed()
speedx += (_xmouse - oldX) * power * strength/100;
speedy += (_ymouse - oldY) * power * strength/100;

You should be able to drag the object around the screen, and throw it off in different directions. Try playing with the range and strength variables for different effects.

5 thoughts on “Mouse-wobbling blobby things

  1. We, the un-designed,

    Do solemnly swear – in the interest of our fellow people, our planet and our purse-strings – that from this day forth we shall wholeheartedly endeavour to live a life more in tune with the great cosmic recycling scheme of things. There exists in the universe a code of practice that has not only ensured the survival of our planet for some 4.5 billion years, but has ultimately created a celebratory cornucopia of life. Unfortunately a small, but ultimately powerful, percentage of our own species have taken it upon themselves to upset the natural balance just so that they can hoard baubles and trinkets and all manner of glistening things. This they do in the vain hope that some of the glitter might rub off on themselves and make up for their distinct lack of mojo. Fortunately the laws of survival are neither complicated nor esoteric (which means they’re not going to cost you anything); in fact they’re open to anyone who takes time out to observe the rhythms of the universe. Adhering strictly to the Law of Fives the Great Ignoble Zenarchs developed Five Laws; this doctrine shall henceforth be known as the Uppie Dharma and shall be enshrined by the following five precepts.

    1. The Untruth of Waste
    Sisters and Brothers, there is no such thing as waste; there are only wasted opportunities. Before committing an object to landfill ask yourselves “Can I make further use of this? Can I reuse, repair or re(up)cycle it? Can anyone I know make use of this? Can they reuse, repair or re(up)cycle it?” If the answer to one or any of these questions is “yes’ (or even “maybe’) then the object in question is not waste, it is an opportunity – and every opportunity should be treated with the same respect afforded to each new day or dream of tomorrow. For opportunity is the watchword of the re-renaissance.
    Sisters and Brothers, “Old’ is the new “New’, go forth and re-create.
    2. The I of the Creator
    Sisters and Brothers, we are, as Erich Fromm so wisely observed, creatures that evolved to become creators. The need to create is entirely central to the human condition; indeed it is the culturally induced suppression of the creative urge that has led to the neurosis, alienation and near universal ennui that so infects the modern world. If you do not believe that our species is innately creative then give a child a crayon and let them loose on your wallpaper.
    Sadly, oh Siblings, we are taught to consume rather than create, but, as you well know, that iPhone, sports car, Versace dress or Andy Warhol “original’ will have lost its showroom/gallery aura long before you get it home.
    Sisters and Brothers, it is time to let your imaginations take control, it is time for the re-renaissance.
    3. The Death of Forever
    Sisters and Brothers, we are but farts upon a breeze, we inhabit a transient universe that is ever changing, ever dying, ever dawning. All that exists – all that was, is and will be – flows from one state to another and those little things you try so desperately to possess (gold, diamonds, lovers) melt from your grasp like eddies in a stream; the only thing that lasts forever is impermanence.
    Once we have dispelled the myth of forever then we can let go our grasp of material possessions; all we truly posses is the passing moment, yet we are willing to fill that moment with anxiety and suffering because of our concerns for what we own – or for what we think we should own. As purveyor of (and observer to…) the moment, the organism (us) holds sway over the inanimate (the object) and yet we – the great and intelligent godlike primates of planet Earth – behave as if we were slaves to objects. From now on look upon all things and ask of them “What is this objects value to me in this present moment?” If you haven’t thought of an answer in five minutes then pass that object on to somebody who can make use of it.
    And remember, oh Siblings, that even the already upcycled is constantly upcycleable; indeed there is no end to an objects upcycleability.
    4. The Myth of “Growth’
    Sisters and Brothers, according to the pseudo-scientific mumbo-jumbo known in otherwise serious academic circles as “Economics’, the Holy Grail of the knight errand businessman is eternal “Economic Growth’. Growth, of course, exists in the universe as a transition from one state to another, growth as a process is exciting, adventurous, desirable and necessary, but the notion of growth as an end in itself – indeed the economists even seem to believe in a never ending end!?! – is illogical . Many weed-killers work by inhibiting a plants ability to stop growing, in other words it is killed by being forced to grow beyond its physical boundaries; what is true of plants is true of every other system in the universe.
    Studies have proven that once people have achieved stable access to food and shelter then their happiness level remains constant regardless of added wealth. Personal experience has shown that a person’s mojo actually diminishes with an increase in bank balance. It is delusional to think that more wealth will make you happy (and it’s just plain sad to think that you can buy mojo); therefore economics is founded on delusion.
    Beyond shelter, warmth, food, clothing, companionship and a comfortable pair of shoes, there is only entertainment; ask yourselves, Sisters and Brothers, who suffers for yours?
    5. The Thrill of Thrift
    Sisters and Brothers, “Never buy what you can make ’; herein lies the road to both creative happiness and financial independence (for spiritual independence it is also worth observing the rule “Never break what you cannot remake.’). When it comes to thrift we should look towards the past, for not only have we have forgotten so many thrifty techniques (our grandparents lived much thriftier – and therefore much more environmentally friendly – lives than any modern “green god/goddess’), but by using second hand clothes we can get some truly stylish threads.
    Fashion is little more than creative fascism. I for one am way too vain to wear somebody else’s name on my clothing; the clothes only maketh the man if the man maketh (or upcycleth) the clothes. Every piece of “designer’ clothing is 100% pure wool – that is to say it is a covering for a sheep!; see how faithfully the heard follows the fickle whim of an uptight Prima Donna one day only to laugh at their fashion faux pas the next.
    We like to think that we’re “unique’ and yet we spend a fortune on clothes that will stop us from “standing out’ in a crowd, following fashion guarantees nothing but anonymity. In clothing, décor, transportation and gardening, do your own thing. Come gather ye peacocks and strut.

  2. wobbling to the counter under the weight of twenty books. Among those stacks I have found old favorites that I had forgotten existed (Mouse Tales by Arnold Lobel) and new gems (The Ernest and Celeste, a French series about a sweet bear and mouse). …

  3. wobbling to the counter under the weight of twenty books. Among those stacks I have found old favorites that I had forgotten existed (Mouse Tales by Arnold Lobel) and new gems (The Ernest and Celeste, a French series about a sweet bear and mouse). …

Leave a Reply

Your email address will not be published. Required fields are marked *