Animated dashed line in cytoscape.js - cytoscape.js

I'm new with cytoscape.js and I'd like to know if it's doable to animate a dashed line like in Cytoscape software (Marquee equal line type for example). The aim is to represents a movement.
Thanks !

If you'd like to see a feature like this, feel free to make a pull request on the unstable branch for a numeric line-style-offset style property (offsetting the dots or dashes of the line style by the specified value). That's sufficient to enable the feature, as you can use numeric style properties with the existing animation APIs.

Related

MLT - How to add easing to transition or filter?

Is it possible to make some smooth movement with a picture (or anything else)? An acceleration, deceleration...
I know we can use keyframe geometry to move an element but the movement is not smooth. The goal is to add some easing (ease-in / ease-out / ease-inout...) in a pictures slideshow.
This "bouncy ball" example is not really smooth:
https://github.com/mltframework/mlt/blob/master/demo/mlt_bouncy_ball
My use is with the command line on a linux server, I do not use any Kdenlive or shotcut.
The bouncy ball example is not intended to show smoothness or easing. The examples are basic intended to get people to walk before running.
MLT Property Animation defines "smooth" keyframes. In order to make something move, you need to pick a filter such as affine that supports animated position properties. Then, how you define keyframes and their types depends on whether using the API or a property string value (command line, XML). When using the multi-value string format, you use ~= instead of = between the time and the value. For example with the affine filter:
transition.rect=0~=0/0:100%x100%;100~=45%/45%:100%x100%;120~=50%/50%:100%x100%
Now, smooth keyframes alone do not provide easing, but you can add one or more keyframes towards the target (ease in) or leaving the target (ease out). The smooth keyframes simply help make the curve instead of you having to add many keyframes to smooth it out yourself. Think about drawing a curve with an illustration program. If you only have a straight line tool that connects at points, you need many points to make a smooth curve - the more points, the more smooth it will be. Now, if you have a curve tool, then you only need a few points. The Catmull-Rom spline used by MLT smooth keyframes was chosen for simplicity: It draws a curve through the points given.
As is often repeated, the easiest way to learn how to use the filters and their properties is to mock things up in a video editor and view its MLT XML output. Keep the project as simple as possible to keep the amount of XML to look through shorter.

Cytoscape with Haystack or Bezier Layout: How to Shorten Edge Length

I am new to Cytoscape, and I have a working graph, but my nodes are very far apart. While I realize Cytoscape generates everything dynamically, it seems like it should be possible to say "use half as much space between nodes".
This demo:
http://js.cytoscape.org/demos/2ebdc40f1c2540de6cf0
seems to show that you can dynamically change the lengths of edges. However, when I look at the source code (https://gist.github.com/maxkfranz/2ebdc40f1c2540de6cf0), I can't figure out how it works.
It seems like the demo is passing a edgeLength option to makeLayout, but the Cytoscape documentation doesn't even mention edgeLength as a valid option.
Can anyone more experienced with Cytoscape point me to how I can shorten the edges between my nodes?
Each layout is different, and the combination of values you use depends on what effect you're trying to create.
Force-directed layouts usually have a weight that affects edge length by spring forces.
In general, the bounding box can affect the length.
Some layouts have spacing adjustment multipliers.
Some layouts have other, miscellaneous options that affect edge length.
You have to look at the options for the layout you're interested in and experiment with them to get the effect you're looking for. That holds true for every layout for every graph theory lib, Cytoscape included.

How to render text on a MKPolyline

Here is basically what I am trying to do:
1) Draw some routes on a map (Simple enough using MKPolyline and MKPolylineRenderer)
2) Label the routes (preferably repeat the label if there is room along the route)
Set Font of Text
Have Text follow the polyline's curves
I know the answer involves extending a class, but I'm not sure as to whether its MKPolyline or MKPolylineRenderer nor which method to handle it in.
If your routes are relatively static, you may have better luck creating lines and labels with something like TileMill and pre-rendering alpha-transparent raster tiles to use with an MKTileOverlay. Aside from label placement along your lines, you will also have to deal with orientation changes, collisions between labels at junctions, varying zoom levels and changing the placement of the text during the changes, etc. You could instead leverage a label symbolizer that already does this sort of thing as in TileMill.

How best to create a Windows 8 Metro Hub Page

I want to create a Windows 8 Metro application that has a fancy "hub" page similar to the following:
http://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-51-31-metablogapi/3482.landing_2D00_branded_5F00_thumb_5F00_287109A4.jpg
The key elements are: Horizontal Panorama style scrolling page but with "sections" that are data bound. I've had a look around for implementations and have come up short.
Seems to me it would be possible to do with a ScrollViewer that contains a Horizontal Stackpanel that has the elements that make up each section. But seeing as this is such a common Metro design pattern, I figure there is probably an easier / recommended way of implementing.
Just wondering if someone can give me some tips. How would you do it?
When you start using VariableSizedWrapGrid all things get their own relative sizes. http://msdn.microsoft.com/en-us/library/windows/apps/br227651.aspx
Set the ColumnSpan and RowSpan properties to make things double size, tripple size etc...
For me I make the first item in the collection double width, double height by setting ColumnSpan and RowSpan to 2. All other items get this ColumnSpan and Rowspan to 1, and it's getting a nice effect.
In addition to what Hans mentioned, I would highly recommend going through the existing Metro Style App Samples. Learning from working examples works better than any documentation.

custom colors in bing maps?

I was looking at http://www.msnbc.msn.com/id/26295161/ns/weather/ and noticed that the flash map is provided by bing and have a custom color scheme. I have a similar need to show maps with a black & white colortheme, is it possible using their api or have they made custom tiles ? (doesnt seem feasible to provide tiles for alls maps on all levels :)
If you are not wedded to Bing maps, you could look into Mapbox, which provide maps based on OpenStreetMap in any style that you desire.
This question is still not answered and even if it's kind of old, I think it matters.
In fact, they're not using different tiles or a custom tile scheme. You can see those in the network inspection tool.
Since they're inside a Flash application, they can easily change the color of the image using filter on image (ColorMatrixFilter) and changing dynamically on the client side the rendered colors.
Well now some years later you can: https://msdn.microsoft.com/en-us/library/mt823636.aspx :-)
(I got here by looking for some sample styles and thought I add the link for anybody else finding this question)
Perhaps a custom tile skinner is that you need: http://rbrundritt.wordpress.com/2009/11/27/bing-maps-custom-tile-skinner/
In this example, the author changes the color of roads using ColorMatrix and ColorMap:
The two key methods used to transform the colors
consist of using ColorMatrix or a ColorMap. By
using a color matrix all the colors on the tile
can be changed within a couple lines of code. Using
a ColorMap allows you to change one color at a
time. This is useful if you only want to change a
few colors on the map.