Pen Settings

JavaScript

Babel includes JSX processing.

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

Flutter

              
                /* IDEA ORIGINATED FROM velog.io@locked !! */
/* https://velog.io/@locked/Flutter-3D-Layer-Card */

// Copyright (c) 2019, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  final String title;

  const MyHomePage({
    Key? key,
    required this.title,
  }) : super(key: key);

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage>
    with SingleTickerProviderStateMixin {
  late final AnimationController _controller;

  final CurveTween _curve = CurveTween(curve: Curves.easeInOutCubic);
  final double _rotateX = .75;
  final double _rotateZ = .5;
  final double _elevation = 100.0;

  bool _isForwarded = false;
  bool _isHovering = false;

  @override
  void initState() {
    super.initState();
    _controller = AnimationController(
        vsync: this, duration: const Duration(milliseconds: 750));
//           ..repeat();
  }

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return AnimatedBuilder(
      animation: _controller,
      builder: (BuildContext context, Widget? child) {
        return Scaffold(
          backgroundColor:
              ColorTween(begin: Colors.grey[50], end: Colors.grey[900])
                  .evaluate(_controller),
          body: Center(
            child: MouseRegion(
              onEnter: (_) => {_controller.forward(), _isHovering = true},
              onExit: (_) => {_controller.reverse(), _isHovering = false},
              child: GestureDetector(
                onTap: () {
                  _isHovering
                      ? {}
                      : {
                          _isForwarded
                              ? {_controller.reverse(), _isForwarded = false}
                              : {_controller.forward(), _isForwarded = true}
                        };
                },
                child: Stack(
                  alignment: Alignment.center,
                  children: [
                    Transform.translate(
                      offset: Offset(
                          0,
                          Tween(begin: .0, end: _elevation * 0.75)
                              .chain(_curve)
                              .evaluate(_controller)),
                      child: Transform(
                        alignment: FractionalOffset.center,
                        transform: Matrix4.identity()
                          ..rotateX(Tween(begin: .0, end: _rotateX)
                              .chain(_curve)
                              .evaluate(_controller))
                          ..rotateZ(Tween(begin: .0, end: _rotateZ)
                              .chain(_curve)
                              .evaluate(_controller)),
                        child: Container(
                          width: 200,
                          height: 200,
                          decoration: BoxDecoration(
                            color: Colors.transparent,
                            boxShadow: [
                              BoxShadow(
                                color: (ColorTween(
                                        begin: Colors.black.withOpacity(0.45),
                                        end: Colors.white.withOpacity(0.25))
                                    .evaluate(_controller))!,
                                spreadRadius: 6,
                                blurRadius: 45,
                              ),
                            ],
                          ),
                        ),
                      ),
                    ),
                    Transform.translate(
                      offset: Offset(
                          0,
                          Tween(begin: .0, end: _elevation * -0.25)
                              .chain(_curve)
                              .evaluate(_controller)),
                      child: Transform(
                        alignment: FractionalOffset.center,
                        transform: Matrix4.identity()
                          ..rotateX(Tween(begin: .0, end: _rotateX)
                              .chain(_curve)
                              .evaluate(_controller))
                          ..rotateZ(Tween(begin: .0, end: _rotateZ)
                              .chain(_curve)
                              .evaluate(_controller)),
                        child: Container(
                          width: 200,
                          height: 200,
                          color: (ColorTween(
                                  begin: Colors.grey[200], end: Colors.white)
                              .evaluate(_controller))!,
                        ),
                      ),
                    ),
                    Transform.translate(
                      offset: Offset(
                          0,
                          Tween(begin: .0, end: _elevation * -1.25)
                              .chain(_curve)
                              .evaluate(_controller)),
                      child: Transform(
                        alignment: FractionalOffset.center,
                        transform: Matrix4.identity()
                          ..rotateX(Tween(begin: .0, end: _rotateX)
                              .chain(_curve)
                              .evaluate(_controller))
                          ..rotateZ(Tween(begin: .0, end: _rotateZ)
                              .chain(_curve)
                              .evaluate(_controller)),
                        child: Container(
                          width: 200,
                          height: 200,
                          decoration: BoxDecoration(
                            color: Colors.transparent,
                            border: Border.all(
                              color: Colors.pink,
                              width: 6.0,
                            ),
                          ),
                        ),
                      ),
                    ),
                    Transform.translate(
                      offset: Offset(
                          0,
                          Tween(begin: .0, end: -2.25 * _elevation)
                              .chain(_curve)
                              .evaluate(_controller)),
                      child: Transform(
                        alignment: FractionalOffset.center,
                        transform: Matrix4.identity()
                          ..rotateX(Tween(begin: .0, end: _rotateX)
                              .chain(_curve)
                              .evaluate(_controller))
                          ..rotateZ(Tween(begin: .0, end: _rotateZ)
                              .chain(_curve)
                              .evaluate(_controller)),
                        child: Container(
                          padding: const EdgeInsets.all(24.0),
                          width: 200,
                          height: 200,
                          decoration: BoxDecoration(
                            color: Colors.transparent,
                            border: Border.all(
                              color: (ColorTween(
                                      begin: Colors.transparent,
                                      end: Colors.white.withOpacity(0.2))
                                  .evaluate(_controller))!,
                              width: 4,
                            ),
                          ),
                          child: Column(
//                           mainAxisAlignment: MainAxisAlignment.start,
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: [
                              Text(
                                '3D Layer Card',
//                             textAlign: TextAlign.center,
                                style: TextStyle(
                                  fontWeight: FontWeight.w600,
                                  fontSize: 16.0,
                                  color: (ColorTween(
                                          begin: Colors.black,
                                          end: Colors.white.withOpacity(0.8))
                                      .evaluate(_controller))!,
                                ),
                              ),
                              const SizedBox(height: 6.0),
                              Text(
                                '@n.Limbo',
//                             textAlign: TextAlign.center,
                                style: TextStyle(
//                                 fontWeight: FontWeight.w600,
                                  fontSize: 12.0,
                                  color: (ColorTween(
                                          begin: Colors.black,
                                          end: Colors.white.withOpacity(0.8))
                                      .evaluate(_controller))!,
                                ),
                              ),
                            ],
                          ),
                        ),
                      ),
                    ),
                  ],
                ),
              ),
            ),
          ),
        );
      },
    );
  }
}

              
            
!
999px

Console