Search This Blog

2 June 2011

Harry Jenkins - Project Write-up

Complimentary studies and Interactive Media
The final project we decided on was a security system. We wanted to use a pressure pad or a laser to detect if there’s movement. Come the day of the installation we had to decide on using one or the other, and decided on the pressure pad. We decided to set it up at the entrance to the classroom, and monitor.
Working as a group was difficult, because of absences, mine included. I had problems with members of my family which interfered two Thursdays in a row, which I would rather not discuss here. I also think that it’s easy to lose focus and drive on a project that has no visible impact on the course, aside from passing and failing. I think it is this and a combination of other factors that led to the project not being as successful as it might otherwise be. I understand that this write-up may be taken as being irreverant or indeed, irrelevant - but this is an honest account of how I feel the coursework went.

26 May 2011

Evaluations on the Project

Here is a link to Elliot Walbys' Evaluation on the project.

http://hotfile.com/dl/118990731/a7ace5b/Evaluation.docx.html

Security system 2

OK, so this is the AS3 code we ended up using:


import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.events.KeyboardEvent;




var bandwidth:int = 0; // Maximum amount of bandwidth that the current outgoing video feed can use, in bytes per second.
var quality:int = 100; // This value is 0-100 with 1 being the lowest quality. 


var cam:Camera = Camera.getCamera();
cam.setQuality(bandwidth, quality);
cam.setMode(320,240,30,false); // setMode(videoWidth, videoHeight, video fps, favor area)
var video:Video = new Video();
video.attachCamera(cam);
video.x = -500;
video.y = -500;
addChild(video);


//This tells flash to detect a webcam and 
//attach its video feed to the stage
//(this particular feed is hidden outside the stage)


var bitmapData:BitmapData = new BitmapData(video.width,video.height);


var bitmap:Bitmap = new Bitmap(bitmapData);










stage.addEventListener(KeyboardEvent.KEY_DOWN, alarm);
function alarm(event:KeyboardEvent):void{
if (event.keyCode==74){

//This tells flash to 'listen' for a keyboard 
//command. If key 74 (j) is pressed, do the following:


bitmap.x = 119;
bitmap.y = 72;
bitmap.width = 320;
bitmap.height = 240;
addChild(bitmap);
bitmapData.draw(video);

// This tells flash to place a still image from 
//the video feed at the moment of the keyboard 
//command at the specified co-ordinates


var theDate:Date = new Date( );
var day = theDate.toLocaleDateString() // This tells flash to define the var 'date' by the computers RTC (real time clock)
var time = theDate.toLocaleTimeString()// This tells flash to define the var 'time' by the computers RTC


time_txt.text = time;
// This tells flash to input the time 
//as defined by the previous var statement 
//into the 'time_txt' object


day_txt.text = day;
// This tells flash to input the date 
//as defined by the previous var statement 
//into the 'day_txt' object
}
}




I've commented it out to make it easier to understand

Elliot made a background to go with this project.




So basically, our idea was to have the system to start capturing a video when a sensor was tripped and save it to 2 places after it has stopped recording an hour after the last sensor was tripped. However, without PHP and a online flash server, we cannot save the files. Also, Flash really doesn't like recording video. It requires each frame to be drawn into Bitmaps individually and then compiled and rendered into an animation.

Now we don't know PHP or have an online flash server or have to time to do either.

We settled with capturing an image from a video feed. When the SWF is open, it starts using the webcam just streaming a live feed to the stage, then when the sensor is activated, flash creates an image from the video feed and places it on the stage.

We cannot save these images so the only thing you can see is the last thing it saw. This is less than perfect but all we can do at this point.

19 May 2011

Security System

So, our Idea is a security system. This is the basic map below.








































We can use the pressure pad code and the laser code to turn on the camera (webcam). I'm just lost on the logs :S

So I got the webcam working with

output_vid.attachVideo(Camera.get());

Where output_vid is the name of my movie clip. So now I got an image showing webcam.

I'm getting the feeling you can't save a movie.Apparently it can't interact with your PC or something. I'd need to use some PHP which I don't have time for so we're now pretending it records.


this.onEnterFrame = function()
{
if (Key.isDown(80))
{
gotoAndStop(2)


}
}


But for some reason, it's now not working. It worked for a minute, I tried to change some things to time the last frame but then nothing. I removed the changes, put it right back and nothing.


With all of these hiccups, Lee is giving us some new code. We're removing the video for a snapshot with time and date. I'd like to be able to store them after they were taken

24 March 2011

Light and pressure activated animations

So today we were tasked with making a Light interactive flash app. I missed last week so I need the script for flash. I am using Flash CS5 Action Script 2.0

It is as follows:


onClipEvent (enterFrame) {
if (!Key.isDown(80)){
_root.play();
}
}

so that means if key 'P' is pressed, the movie plays.
We have a image of TNT and when the image plays, the timer counts down from 10, then there is an explosion. Pretty simple but this is the first project we have completed.

Then we have to set up a light sensor. A simple light sensor, taped up to two cables. They would be connected to a port and then put into the computer. The sensor would be placed in the end of a biro pen with a small hole cut in it to allow a small amount of light in. 
Then we have a laser which will be pointed at the sensor. When the beam is broken, the animation plays. Simples!

I'm going to get the other Action Scripts and post them here. So there will be pressure sensitivity, camera and sound interaction. Just for reference :)

Edit: It works!!
See below!

The final animation







This is the tool which we plugged
the light sensor into.
It goes into USB.
The business end of the same object
it has a midi port.

This is the 'laser' we used. A simple light pen.
It took ages to align it with the light sensor.
It was taped down well
The light sensor
The light sensor in action. It is inside the pen cap
and taped to the leg of a table
Guy setting up the laser pen


_______________________________________________________________________________

The week before I was away, however the group informed me that we were tasked with creating a pressure activated animation. As our group has an odd sense of humour, they chose to have Bella (from that gawd-awful Twilight Book and Movie series) which you can 'punch in the face' by hitting the pressure pad.

The set-up was the same (sensor attached to that USB-chip thing) with the same coding.


onClipEvent (enterFrame) {
if (!Key.isDown(80)){
_root.play();
}
}

Now obviously the pressure pad is assigned to P

--The general idea here was to have two pressure pads, one would be for each side of the face. When you press the left pad the animation (getting more and more beaten up and bruised) would advance by one frame, and likewise for the right pad and the right side of the face animation. We had several problems trying to implement this: the first is that we could not get hold of two pressure pads. Secondly, we could not get the animation to advance by one frame only. Thirdly, the sound effect we wanted to add to the code, would not play once, it would play constantly.

10 March 2011

Video Activated Animations

This week we were tasked with having a action activated animation. The group agreed on Guys idea of movement activating the music to Keyboard Cat and when you move too much, you get rick roll'd.
Again, this didn't get completed.

Elliot and I tried to get it done at home, but by the time we got back, we couldn't work out what we had done in the lesson so we couldn't do it.

We need the basic code!

--The problem has tended to be that none of us are experienced enough with flash to achieve what we set out to do. The animation takes up the entire lesson to get completed and then the original code that was going to be used doesn't fit anymore, either because the project has become slightly too complex or the was an error in the class that we failed to spot.

Sound Activated Animations

On the first week, our group was tasked with creating an animation which was activated by sound. The group idea was a roller-coaster which got faster the louder you got. Due to some issues, the initial animation never got coded this lesson.

Our group is:
Myself
Elliot Walby
Harry Jenkins
Richard VanVilet (Henry)
Guy Yates

--The idea was to have the animation change according to the amount of sound picked up by the microphone. The man in the roller-coaster would scream/look more and more terrified, the louder it was. The coding for this proved tricky as the animation was on several different layers and we weren't able to influence them separately.