- Recent
- Popular
- Tags (1)
- Subscribers (8)
- Animated Polyline Interpolations in SilverlightYesterday
-
In my Monday blog entry I used the CompositionTarget.Rendering event to animate an interpolation between two equally sized PointCollection objects.
I like CompositionTarget.Rendering: It takes all the guesswork out of deciding what period to use for timer animations. But whenever possible I think it's best to use the Timeline derivatives in Silverlight for animation. There are many advantages, not the least being that you can define them in XAML, and they are much more easily integratable with other animations.
That's the purpose of the PointCollectionInterpolator class that is part of the downloadable PolylineInterpolationDemo project.
PointCollectionInterpolator derives from FrameworkElement (I'll explain why shortly) and defines four dependency properties: Points1 and Points2 of type PointCollection, Progress of type double, and InterpolatedPoints, also of type PointCollection. Whenver one of the first three properties changes, the class executes the following code:
The PointCollectionInterpolator is instantiated as a resource (along with two PointCollection objects) in the Page.xaml file:
Notice
- Animating Points and PointCollections in SilverlightJanuary 5
-
In an ancient blog entry I presented a XAML file that had 13 PointAnimation objects running in parallel to animate a square into a circle and back again.
The animations in that XAML file target the various properties of BezierSegment objects, and it converted very smoothly into Silverlight. Here's the SquaringTheCircle.zip source code (everything I did is in Page.xaml) and you can see it action here:
But I've also been wondering about the feasibility of doing more interesting vector animations in Silverlight. For example, almost two years ago I wrote an article for MSDN Magazine about extending the WPF animation classes to include interpolations between entire PointCollection objects. One example was a templated CheckBox that morphed between a vector "yes" and "no" when it was toggled.
I know that it's not possible to extend the Silverlight animation classes, but perhaps there are workarounds. Here's a feasibility study of a Silverlight text morph:
- Mind Your Freeze and Q’sJanuary 4
-
Whenever the subject of performance in the Windows Presentation Foundation comes up, the issue of Freezables is likely to be mentioned. But regardless how much we think we know about the subject, it's still easy for experienced WPF programmers to get burned. I'll be describing something that happened to me recently that reinforced how much we need to pay diligent attention to objects of type Freezable.
Some background: The Freezable class derives from DependencyObject and adds extra layers of change notifications. A dependency property of type Freezable will fire a change notification whenever the object itself changes, of course, but also when any property or sub-property of the object changes, as long as those properties are also of type Freezable.
For example, suppose you have a class containing a dependency object of type PathGeometry. Your class will receive notifications whenever a different PathGeometry is assigned to that property, of course, but also when any component of that PathGeometry changes, for example, the Point1 property of a BezierSegment object that is a member of a Segments collection that belongs to a PathFigure object that is a member of the Figures collection that belongs to the PathGeometry. The PathGeometry, PathFigure, BezierSegment, PathFigureCollection, and PathSegmentCollection
- Reading “For the Thrill of It”January 2
-
I think I first became aware of the Leopold & Loeb case from seeing the 1959 movie Compulsion on TV when I was a kid. Based on a 1956 novel by Meyer Levin, the movie stars Dean Stockwell as the brilliant but deeply disturbed "Judd Steiner," Bradford Dillman as the charming but deeply disturbed "Artie Straus," and Orson Welles as the world-famous "atheist" attorney "Jonathan Wilk." (The movie still holds up quite well. It's much more historically accurate than you might assume, and it's great fun seeing how the filmmakers get away with suggesting the nature of the relationship between "Judd" and "Artie" without being explicit about it.)
About 10 years ago I attempted to supplement my knowledge of this fascinating case. Aided by the new (but now pretty much defunct) online used-book search engine Bibliofind, I found one book containing trial transcripts (albeit somewhat censored) and what was apparently the only existing book-length study, Hal Higdon's The Crime of the Century: The Leopold and Loeb Case from 1975. Oddly enough, no-one else thought the case interesting enough for another history.
Enter historian Simon Baatz, who first became aware of Leopold & Loeb after seeing Alfred Hitchcock's 1948 film Rope in a Brighton repertory cinema. Rope was an Americanized adaptation of a 1929 play by Patrick Hamilton, certainly inspired by Leopold & Loeb, but retaining only the psychology of the killers while compl
- Re-Infection with Recurrent Ear WormDecember 16 2008
-
I've been re-invected by an extremely nasty ear worm. It has gotten inside my head and plays in a continuous loop. This particular strain of ear worm has been mostly dormant for several months, ever since the movie based on a musical based on a song based on an Italian expression of surprise arrived in theatres and then left — I hesitate to mention the title because that alone is capable of touching off a vicious outbreak that can last for hours — but now the DVD has been released, and again the culture is awash with that song and several others from the same source.
I wouldn't complain if I had brought this on myself. But I have never sought out this music. It has instead oozed out of the environment into my ears. Without my permission, it has attacked my central nervous system and burrowed deep into my brain, stealing essential neurons to forever preserve the memory of those silly lyrics and insipid tunes.
Of course there's no legal recourse. If instead of playing music, a quartet of Swedes were following me around on the streets and knocking me on the back of my head, I could probably find a way to make them stop. Even if they had no physical contact with me but were instead flashing images in my eyes of apple-cheeked adolescents joyously dancing with arms waving above their empty heads, I might be able to make a case for legal restraint.
But music falls into a whole other category. Apparently there's nothing you can do to pre
