TizenPortal includes smooth focus transition effects inspired by Samsung’s Tizen Browser. This feature provides polished, TV-style animations that evoke the direction of movement and enhance the user experience.
Focus transitions add subtle animations when navigating between UI elements, making the interface feel more responsive and providing visual feedback about the direction of movement.
The slide mode is the most sophisticated transition, providing directional feedback that matches the user’s navigation.
How it works:
Visual effect:
Best for:
Example:
[Card 1] → [Card 2] → [Card 3]
↑
focused
User presses RIGHT
↓
[Card 1] [Card 2] → [Card 3]
←─────────↑
slides from left
(focused)
The scale mode provides a simple growing effect that draws attention to the newly focused element.
Visual effect:
Best for:
The glow mode creates a pulsing shadow effect around the focused element.
Visual effect:
Best for:
Focus transitions can be configured globally via the Preferences UI:
// Via TizenPortal.config API
TizenPortal.config.set('tp_features', {
focusTransitions: true, // Enable/disable
focusTransitionMode: 'slide', // 'slide', 'scale', 'glow', or 'off'
focusTransitionSpeed: 'medium', // 'fast', 'medium', or 'slow'
});
Bundles can apply custom transition settings:
export default {
name: 'my-bundle',
onActivate: function(win, card) {
// Apply custom transition settings for this bundle
if (win.TizenPortal && win.TizenPortal.features) {
var doc = win.document;
var focusTransitions = win.TizenPortal.features.focusTransitions;
if (focusTransitions) {
// Apply custom mode and speed
focusTransitions.apply(doc, 'scale', 'fast');
}
}
},
};
The focus transitions feature is implemented as a standard TizenPortal feature in features/focus-transitions.js.
Components:
For slide mode, the system:
focusin eventsdata-tp-focus-from attribute on the focused element/* Base transition */
:focus {
transition: outline 0ms, transform 250ms ease-out,
opacity 250ms ease-out !important;
}
/* Directional animations */
[data-tp-focus-from="left"]:focus {
animation: tp-slide-from-left 250ms ease-out;
}
@keyframes tp-slide-from-left {
from {
transform: translateX(-8px);
opacity: 0.6;
}
to {
transform: translateX(0);
opacity: 1;
}
}
calculateDirection: function(prevEl, currEl) {
// Get bounding rectangles
var prevRect = prevEl.getBoundingClientRect();
var currRect = currEl.getBoundingClientRect();
// Calculate center points
var prevX = prevRect.left + prevRect.width / 2;
var prevY = prevRect.top + prevRect.height / 2;
var currX = currRect.left + currRect.width / 2;
var currY = currRect.top + currRect.height / 2;
// Calculate deltas
var deltaX = currX - prevX;
var deltaY = currY - prevY;
// Primary direction based on larger delta
if (Math.abs(deltaX) > Math.abs(deltaY)) {
return deltaX > 0 ? 'right' : 'left'; // Horizontal
} else {
return deltaY > 0 ? 'bottom' : 'top'; // Vertical
}
}
Why CSS animations?
Memory usage:
CPU usage:
Slide (Directional)
Scale (Grow)
Glow (Pulse)
Fast (150ms)
Medium (250ms) - Default
Slow (400ms)
Users can disable transitions by:
focusTransitionMode: 'off' programmaticallyThis may be desirable for:
Check configuration:
var config = TizenPortal.config.get('tp_features');
console.log('Transitions enabled:', config.focusTransitions);
console.log('Mode:', config.focusTransitionMode);
console.log('Speed:', config.focusTransitionSpeed);
Verify feature is applied:
<style id="tp-focus-transitions"> in document headCheck for conflicts:
!important rules may interfereDirection detection relies on element positions. Issues may occur with:
Solution: Consider using scale or glow mode for irregular layouts.
If transitions cause performance problems:
Focus transitions work on:
CSS animations are widely supported. Graceful degradation occurs on very old browsers (no transition, instant focus change).
For a grid of content cards (Netflix-style):
Recommended:
For a vertical list of settings:
Recommended:
For playback controls (play, pause, next, etc.):
Recommended:
For users with visual impairments:
Recommended:
The focusTransitions feature object is available via:
window.TizenPortal.features.focusTransitions
Methods:
getCSS(mode, speed)Generate CSS for the specified mode and speed.
mode (string): ‘slide’, ‘scale’, ‘glow’, or ‘off’speed (string): ‘fast’, ‘medium’, or ‘slow’calculateDirection(prevEl, currEl)Calculate movement direction between two elements.
prevEl (Element): Previous focused elementcurrEl (Element): Current focused element| Returns: (string | null) ‘left’, ‘right’, ‘top’, ‘bottom’, or null |
apply(doc, mode, speed)Apply transitions to a document.
doc (Document): Target documentmode (string): Transition modespeed (string): Transition speedremove(doc)Remove transitions from a document.
doc (Document): Target documentupdate(doc, mode, speed)Update transition settings (convenience method, calls apply).
doc (Document): Target documentmode (string): New modespeed (string): New speedPossible future improvements:
prefers-reduced-motion media queryFocus transitions provide a polished, professional feel to TizenPortal interfaces. The slide mode’s directional awareness creates intuitive visual feedback, while alternative modes offer flexibility for different use cases.
The feature is:
Experiment with different modes and speeds to find what works best for your content!